$(".button").click(function(){
    return(checkpho() && checkpassword() && checktelephonesure())
})

//验证邮箱
$(".pho-check").blur(checkemailTip);
function checkemailTip(){
    var email = $(".pho-check").val()
    if(email == null || email == ""){
        $("#telephonenumberTip").text("手机号/邮箱不能为空")
    }else if((!/^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/||!/^[1][3,4,5,7,8][0-9]{9}$/).test(email)){
        $("#telephonenumberTip").text("请输入正确格式的手机号/邮箱")
    }
    else{
        $("#telephonenumberTip").text("")
    }
}
function checkpho(){
    var email = $(".pho-check").val()
    if(email == null || email == ""){
        alert("手机号/邮箱不能为空")
        return false
    }else if((!/^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/||!/^[1][3,4,5,7,8][0-9]{9}$/).test(email)){
        alert("请输入正确格式的手机号/邮箱")
        return false
    }
    else{
        return true
    }
}

//验证密码
$(".password-pass").blur(checkpasswordTip);
function checkpasswordTip(){
    var password = $(".password-pass").val()
    if(password == null || password == ""){
        $("#passwordTip").text("密码不能为空")
    }else if(!/^[0-9A-Za-z]{6,12}$/.test(password)){
        $("#passwordTip").text("请输入格式正确的密码")
    }else{
        $("#passwordTip").text("")
    }
}
function checkpassword(){
    var password = $(".password-pass").val()
    if(password == null || password == ""){
        alert("密码不能为空")
        return false
    }else if(!/^[0-9A-Za-z]{6,12}$/.test(password)){
        alert("请输入正确格式的密码")
        return false
    }else{
        return true
    }
}


//短信验证
$("#telephonesure").blur(checktelephonesureTip);
function checktelephonesureTip(){
    var telephonesure = $("#telephonesure").val()
    if(telephonesure == null || telephonesure == ""){
        $(".telephonesureTip").text("请输入验证码")
    }else{
        $(".telephonesureTip").text("")
    }
}
function checktelephonesure(){
    var telephonesure = $("#telephonesure").val()
    if(telephonesure == null || telephonesure == ""){
        alert("请输入验证码")
        return false
    }else{
        return true
    }
}